package com.sso.common;

import com.sso.entity.SysUser;
import com.thoughtworks.xstream.XStream;
import com.tools.entity.Root;
import com.tools.util.HttpUtils;
import org.apache.shiro.crypto.hash.Hash;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.StringWriter;
import java.util.*;

public class Test {

    private LinkedList<Integer> list;

    public Test() {
        list = new LinkedList<Integer>();
    }
    //No.1
    //开始写代码，完成双端队列的方法
    public void offerFirst(int i){
        list.offerFirst(i);
    }
    public void offerLast(int i){
        list.offerLast(i);
    }
    public Object pollFirst(){
        return list.pollFirst();
    }

    //end_code
    public boolean isEmpty() {
        return list.isEmpty();
    }

    public int size() {
        return list.size();
    }

    public static void main(String[] args) {
        Test doubleQueue = new Test();
        System.out.println(doubleQueue.size());
        for (int i = 0; i < 5; i++) {
            doubleQueue.offerFirst(i);
        }
        for (int i = 0; i < 5; i++) {
            doubleQueue.offerLast(i);
        }
        System.out.println("size:" + doubleQueue.size());
        int size = doubleQueue.size();
        for (int i = 0; i < size; i++) {
            int remove = (int) doubleQueue.pollFirst();
            System.out.println("size:" + doubleQueue.size() + " remove:" + remove);
        }
        System.out.println(doubleQueue.size());

    }
}